This invention relates generally to computer programming methods pertaining to real-time applications and more specifically to programming methods which enable the development of real-time software that can run on computer systems of different designs.
Java (a trademark of Sun Microsystems, Inc.) is an object-oriented programming language with syntax derived from C and C++. However, Java""s designers chose not to pursue full compatibility with C and C++ because they preferred to eliminate from these languages what they considered to be troublesome features. In particular, Java does not support enumerated constants, pointer arithmetic, traditional functions, structures and unions, multiple inheritance, goto statements, operator overloading, and preprocessor directives. In their place, Java requires all constant identifiers, functions (methods), and structures to be encapsulated within class (object) declarations. The purpose of this requirement is to reduce conflicts in the global name space. Java provides standardized support for multiple threads (lightweight tasks) and automatic garbage collection of dynamically-allocated memory. Furthermore, Java fully specifies the behavior of every operator on every type, unlike C and C++ which leave many behaviors to be implementation dependent. These changes were designed to improve software scalability, reduce software development and maintenance costs, and to achieve full portability of Java software. Anecdotal evidence suggests that many former C and C++ programmers have welcomed these language improvements.
One distinguishing characteristics of Java is its execution model. Java programs are first translated into a fully portable standard byte code representation. The byte code is then available for execution on any Java virtual machine. A Java virtual machine is simply any software system that is capable of understanding and executing the standard Java byte code representation. Java virtual machine support is currently available for Apple Macintosh, Microsoft NT, Microsoft Windows 95, Silicon Graphics IRIX, and Sun Solaris. Ports to other environments are currently in progress. To prevent viruses from being introduced into a computer by a foreign Java byte-code program, the Java virtual machine includes a Java byte code analyzer that verifies the byte code does not contain requests that would compromise the local system. By convention, this byte code analyzer is applied to every Java program before it is executed. Byte code analysis is combined with optional run-time restrictions on access to the local file system for even greater security. Current Java implementations use interpreters to execute the byte codes but future high-performance Java systems will have the capability of translating byte codes to native machine code on the fly. In theory, this will allow Java programs to run approximately at the same speed as C++.
Within Sun, development of Java began in April of 1991. Initially, Java was intended to be an implementation language for personal digital assistants. Subsequently, the development effort was retargeted to the needs of set-top boxes, CD-ROM software, and ultimately the World-Wide Web. Most of Java""s recent media attention has focused on its use as a medium for portable distribution of software over the Internet. However. both within and outside of Sun, it is well understood that Java is much more than simply a language for adding animations to Web pages. In many embedded real-time applications, for example, the Java byte codes might be represented in system ROMs or might even be pre-translated into native machine code.
Many of the more ambitious xe2x80x9cindustrial-strengthxe2x80x9d sorts of applications that Java promises to enable on the Internet have associated real-time constraints. These applications include video conferencing integrated with distributed white boards, virtual reality, voice processing, full-motion video and real-time audio for instruction and entertainment, and distributed video games. More importantly, the next generation Web client will have even more real-time requirements. Future set-top devices will connect home televisions to the Web by way of cable TV networks. Besides all of the capabilities just mentioned, these systems will also support fully interactive television applications.
Java offers important software engineering benefits over C and C++, two of the more popular languages for current implementation of embedded real-time systems. If Java could be extended in ways that would allow it to support the cost-effective creation of portable, reliable real-time applications, the benefits of this programming language would be realized by a much larger audience than just the people who are implementing real-time Web applications. All developers of embedded real-time software could benefit. Some of the near-term applications for which a real-time dialect of Java would be especially well suited include personal digital assistants, real-time digital diagnosis (medical instrumentation, automotive repair, electronics equipment), robotics, weather monitoring and forecasting, emergency and service vehicle dispatch systems, in-vehicle navigation systems, home and business security systems, military surveillance, radar and sonar analysis, air traffic control, and various telephone and Internet packet switching applications.
Java has much to offer developers of embedded real-time systems. High-level abstractions and availability of reusable software components shorten the time-to-market for innovative products. Its virtual machine execution model eliminates the need for complicated cross-compiler development systems, multiple platform version maintenance, and extensive rewriting and retesting each time the software is ported to a new host processor. It is important to recognize that the embedded computing market is quite large. Industry observers have predicted that by the year 2010, there will be ten times as many software programmers writing embedded systems applications as there will be working on software for general purpose computers.
Unlike many existing real-time systems, most of the applications for which a real-time Java is intended are highly dynamic. New real-time workloads arrive continually and must be integrated into the existing workload. This requires dynamic management of memory and on-the-fly schedulability analysis. Price and performance issues are very important, making certain traditional real-time methodologies cost prohibitive. An additional complication is that an application developer is not able to test the software in each environment in which it is expected to run. The same Java byte-code application would have to run within the same real-time constraints on a 50 MHz 486 and on a 300 MHz Digital Alpha. Furthermore, each execution environment is likely to have a different mix of competing applications with which this code must contend for CPU and memory resources. Finally, every Java byte-code program is supposed to run on every Java virtual machine, even a virtual machine that is running as one of many tasks executing on a time-sharing host. Clearly, time-shared virtual machines are not able to offer the same real-time predictability as a specially designed real-time Java virtual machine embedded within a dedicated microprocessor environment. Nevertheless, such systems are able to provide soft-real-time response.
The invention is a real-time programming method (RTPM) for use in writing application programs to be executed by virtual machines and a method practiced by a real-time virtual machine (RTVM) while executing an application program written in accordance with a real-time programming method. The invention also includes a method for translating an RTPM programming language into a second programming language, the RTPM programming language being an extended version of the second programming language. The RTPM programming language includes real-time code expressions for specifying real-time execution requirements. The method of translating the real-time code expressions is such that the execution of a second-language translation of a RTPM-language application program complies with the real-time execution requirements on a best-effort basis.
The RTPM utilizes a configure method and a negotiate method. The invocation of the configure method in an application program results in the quantification of the needs for one or more resources during execution of the application program by a virtual machine. The invocation of the negotiate method in an application program causes a negotiation to occur between the application program and the virtual machine concerning the allocation of one or more resources to the application program, the resources including CPU time, total memory, and memory allocation rate.
The RTPM utilizes control structures consisting of (1) a keyword identifying the structure, (2) a specified increment of time, and (3) a specified code segment that pertain to timed statements, preemptible timed statements, and aperiodic timed statements. For a timed-statement control structure, it is anticipated that the specified code segment will execute within the specified increment of time, execution otherwise being aborted. For a preemptible-timed-statement control structure, it is anticipated that the specified code segment will execute during a plurality of time slices within an execution period, the plurality of time slices adding up to the specified increment of time, execution otherwise being aborted. For an aperiodic-timed-statement control structure, it is anticipated that the specified code segment will execute in time segments spread over a plurality of execution periods, the time segments in the plurality of execution periods adding up to the specified increment of time, execution otherwise being aborted.
The RTPM also utilizes an atomic-statement control structure. The atomic-statement control structure consisting of (1) a keyword identifying the structure and (2) a specified code segment, the specified code segment being execution-time analyzable, the control structure requiring that either enough time be assigned to execute the specified code segment or that none be assigned.
The real-time tasks handled by the RTPM include periodic, sporadic, ongoing, and spontaneous real-time tasks, the method of execution of a real-time task comprising a startup method, a work method, and a finish method. The startup and finish methods are execution-time analyzable. The startup, work, and finish methods are invoked in sequence each time a periodic, sporadic, or spontaneous task is executed. The startup method is invoked exactly once for an ongoing task following which the work method is invoked and suspended repeatedly. The finish method for the ongoing task is invoked only when the corresponding real-time activity terminates.
The RTPM utilizes a real-time executive object to provide services in response to requests by the application code, the services being intended to provide information relating to the real-time activities.